<template>
	<view class="content">
		<!-- 导航 -->
		<view class="nav">
			<view @click="close"><i class="iconfont iconfanhui-copy"></i></view>
			<view class="navTitle">
				<text v-for="(item,index) in currentList" :key="index" :class="[currentIndex == index ? 'name_active':'']" @tap="titleClick(index)">{{item}}</text>
			</view>
			<view class="right">
				<navigator hover-class="false" url="/pages/topic/search/index"><i class="iconfont iconsousuo--"></i></navigator>
				<!-- <text v-if="currentIndex == 2" @tap="release">我的</text> -->
			</view>
		</view>
		<view class="nav nav1" v-if="currentIndex == 2">
			<!-- 分类 -->
			<view class="navView">
				<scroll-view scroll-x="true">
					<view class="nav_box">
						<block v-for="(item, index) in navList" :key="index">
							<view class="nav_item" @tap="navClick(index)" :class="[navIndex == index?'nav_item_avtive':'']">{{item.name}}</view>
						</block>
					</view>
				</scroll-view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				currentList: ['关注','视频','文章'],
			};
		},
		props: {
			currentIndex: Number,
			navList: Array,
			navIndex: Number
		},
		methods:{
			close:function(){
				uni.showTabBar();
				uni.reLaunch({
					url:'/pages/index/index'
				})
			},
			/* 标题栏切换 */
			titleClick(index) {
				if(index == 0) {
					uni.showTabBar();
					uni.redirectTo({
						url: '/pages/topic/follow'
					})
				} else if(index == 1) {
					uni.switchTab({
						url: '/pages/topic/shortVideo'
					})
				} else if(index == 2) {
					uni.showTabBar();
					uni.redirectTo({
						url: '/pages/topic/recommend'
					})
				}
			},
			/* 类型切换 */
			navClick(index) {
				if(this.currentIndex == 0) {
					
				} else if(this.currentIndex == 1) {
					
				} else if(this.currentIndex == 2) {
					var value = {};
					value.page = 1;
					value.reload = true;
					value.index = index;
					this.$emit('getList',value);
				}
			},
			/* 前往我的抖教 */
			release() {
				uni.navigateTo({
					url: '/pages/articleModule/article-manage?stateType=0'
				})
			}
		}
	}
</script>

<style>
	/* 导航栏 */
	.nav {
		position: fixed;
		top: 0;
		left: 0;
		width: 100%;
		height: 128upx;
		padding: 94upx 6upx 54upx;
		display: flex;
		overflow: hidden;
		justify-content: space-between;
		align-items: center;
		box-sizing: border-box;
		color: #fff;
		background-color: #FF9900;
		transition-property: all;
		z-index: 99999;
	}

	.nav .iconfanhui-copy {
		margin-left: 20upx;
		font-size: 32upx;
		color: #FFFFFF;
	}

	.navTitle {
		position: absolute;
		margin-left: calc(50% - 178upx);
	}

	.navTitle text {
		color: #FFFFFF;
		font-size: 32upx;
		margin: 0 20upx;
	}

	.name_active {
		font-size: 36upx !important;
		font-weight: bold;
	}

	.right {
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}

	.right .iconsousuo-- {
		color: #FFFFFF;
		font-size: 50upx;
	}

	.right text {
		margin: 0 30upx 0 20upx;
		color: #FFFFFF;
		font-size: 30upx;
	}

	/* 类别 */
	.nav1 {
		width: 100%;
		padding: 0;
		position: fixed;
		top: 130upx;
	}

	.navView {
		position: absolute;
		top: 0;
		left: 0;
		width: 100%;
		height: 100upx;
		border-radius: 40upx 40upx 0 0;
		padding: 14upx 0;
		display: flex;
		white-space: nowrap;
		align-items: center;
		background-color: #FFFFFF;
	}
	.nav_box{
		display: flex;
		justify-content: flex-start;
		align-items: center;
	}
	.nav_item {
		display: flex;
		align-items: center;
		justify-content: flex-start;
		flex-direction: column;
		font-size: 30upx;
		color: #999999;
		padding: 0 20upx 0 30upx;
	}

	.nav_item_avtive {
		color: #333333;
		font-size: 34upx;
	}
</style>
